package com.bowen.gulimall.member.web;

import com.bowen.common.utils.R;
import com.bowen.gulimall.member.feign.OrderFeignServer;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.HashMap;
import java.util.Map;

@Controller
public class MemberWebController {

    @Autowired
    private OrderFeignServer orderFeignServer;

    @GetMapping("memberOrder.html")
    public String memberOrderPage(@RequestParam(value = "pageNum", defaultValue = "1") Integer pageNum,
                                  Model model) {
        //获取到支付宝给我们传递过来得数据 request，验证签名

        /**
         * 懒得弄netapp， 没搞，所以直接跳转过来，修改订单状态
         */

        //查出当前登录的用户的所有订单列表数据
        Map<String, Object> page = new HashMap<>();
        page.put("page", pageNum.toString());

        R r = orderFeignServer.listWithItem(page);
        model.addAttribute("orders", r);

        return "orderList";
    }
}
